package com.example.eduservice.controller;

import com.example.common.commonsutils.R;
import com.example.eduservice.entity.EduVideo;
import com.example.eduservice.service.EduVideoService;
import com.example.eduservice.service.FeignService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @Author:tjf
 * @Description:
 */
@RestController
@RequestMapping("/eduservice/video")
@Tag(name = "小节控制器")
public class EduVideoController {
    @Resource
    private EduVideoService videoService;
    @Operation(description = "添加小节")
    @PostMapping("/")
    public R saveVideo(@RequestBody EduVideo video){
        boolean save = videoService.save(video);
        if (save == true){
            return R.ok();
        }
        return R.error();
    }
    @Operation(description = "根据id，删除小节")
    @DeleteMapping("/{id}")
    public R removeVideoById(@PathVariable("id") String id){
        videoService.removeVideoById(id);
        return R.ok();
    }
}
